<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>轮播图</title>
    <style>
      * {
        padding: 0;
        margin: 0;
      }

      #outer {
        width: 520px;
        height: 300px;
        margin: 50px auto;
        background-color: greenyellow;
        padding: 10px 0;
      }

      #imgList {
        list-style: none;
        /* width: 2700px; */
      }

      #imgList li {
        float: left;
        /* display: inline-block; */
        margin: 0 10px;
      }

      img {
        width: 500px;
        height: 300px;
      }
    </style>
  </head>
  <body>
    <div id="outer">
      <ul id="imgList">
        <li><img src="../JavaScript之DOM对象/images/img1.png" /></li>
        <li><img src="../JavaScript之DOM对象/images/img2.png" /></li>
        <li><img src="../JavaScript之DOM对象/images/img3.png" /></li>
        <li><img src="../JavaScript之DOM对象/images/img4.png" /></li>
        <li><img src="../JavaScript之DOM对象/images/img5.png" /></li>
      </ul>
    </div>

    <script>
      var imgList = document.getElementById("imgList");
      var imgs = document.getElementsByTagName("img");

      imgList.style.width = imgs.length * 520 + "px";
    </script>
  </body>
</html>
